import React, { useState } from 'react'
export default function App2() {
    const [count, setCount] = useState(0)
    const [isHot, setIsHot] = useState(true)
    const [person, setPerson] = useState([{
        id: '001',
        name: '魈'
    }, {
        id: '002',
        name: '神里绫华'
    }, {
        id: '003',
        name: '钟离'
    }])
    const setCountHandle = () => {
        setCount(count + 1)
    }
    const setIsHotHandle = () => {
        setIsHot(!isHot)
    }
    return (
        <div>
            <h1>累加的和是多少？ {count}</h1>
            <h2>今天的天气如此{isHot ? '晴朗' : '差劲'}</h2>
            <ul>
                {
                    person.map((item) => {
                        return <li id={item.id}>{item.name}</li>
                    })
                }
            </ul>
            <button onClick={setCountHandle}>＋</button>
            <button onClick={setIsHotHandle}>切换</button>
        </div>
    )
}
